package com.superjson.showpro.entity;

import com.superjson.showpro.base.BaseObj;
import com.beantools.annotation.NotNull;
import com.superjson.showpro.shared.enums.GenderEnum;
import com.superjson.showpro.shared.enums.SignInTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created By zby on 21:11 2019/5/28
 * 用户
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
@Table(name = "sp_user")
@NotNull(notNull = {"password", "phone", "programmingLanguage","signInType"})
public class User extends BaseObj implements Serializable{

    private static final long serialVersionUID = 8410700268987730074L;
    /**
     * 手机号码
     */
    @Column(name = "phone")
    private String phone;

    /**
     * 密码
     */
    @Column(name = "password")
    private String password;

    /**
     * 注册类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "sign_in_type")
    private SignInTypeEnum signInType;


    /**
     * 企业名称
     */
    @Column(name = "company_name")
    private String companyName;

    /**
     * token
     */
    @Column(name = "token")
    private String token;

    /**
     * 账户
     */
    @Column(name = "account_name")
    private String accountName;

    /**
     * 邮箱
     */
    @Column(name = "email")
    private String email;


    /**
     * 注册ip
     */
    @Column(name = "sign_in_ip")
    private String signInIp;

    /**
     * 是否锁定
     */
    @Column(name = "locked")
    private boolean locked = false;

    /**
     * 是否注册：如果未注册，就用ip作为账号
     */
    @Column(name = "signIn")
    private boolean signIn = true;

    /**
     * 编程语言
     */
    @Column(name = "programming_language")
    private String programmingLanguage;

    /**
     * 性别
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "gender")
    private GenderEnum gender;

    /**
     * 昵称
     */
    @Column(name = "nickname")
    private String nickname;

    /**
     * 一句话签名
     */
    @Column(name = "sign")
    private String sign;

    /**
     * area
     */
    @ManyToOne
    @JoinColumn(name = "area_id")
    private Area area;

}